-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8357267: ZGC: Handle APX EGPRs spilling in ZRuntimeCallSpill #25351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
@jatin-bhateja This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 233 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@jatin-bhateja The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
89fbf49
to
79d7778
Compare
/label add hotspot-compiler-dev |
@jatin-bhateja |
@jatin-bhateja Unknown command |
/label add hotspot-gc-dev |
@jatin-bhateja |
Webrevs
|
// Push original stack pointer along with remaining registers on 16B aligned stack. | ||
// Note: For PPX to work properly, a PPX-marked PUSH2 (respectively, POP2) should always | ||
// be matched with a PPX-marked POP2 (PUSH2), not with two PPX-marked POPs (PUSHs). | ||
__ pushp(rcx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is saving old rsp on stack and restored using __ movptr(rsp, Address(rsp)) on the other end in restore(). So this should be __ push(rcx) and not __ pushp(rcx) as there is no corresponding __ popp() instruction for this pushp.
__ push(r11); | ||
if (VM_Version::supports_apx_f()) { | ||
__ push(rax); | ||
__ push(rcx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be __ pushp(rcx).
__ popp(rdx); | ||
// Re-instantiate original stack pointer. | ||
__ movptr(rsp, Address(rsp)); | ||
__ pop(rcx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be __ popp(rcx).
__ push(r10); | ||
__ push(r11); | ||
if (VM_Version::supports_apx_f()) { | ||
__ push(rax); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if _result is not equal to rax this also could be pushp rax here and popp rax in restore().
@xmas92 Could you please also take a look at this? Intel APX add additional GPR registers (R16 - R31). Our understanding is that these also need to be saved and restored as part of ZRuntimeCallSpill. Is that correct? |
ZRuntimeCallSpill is used when doing calls into libjvm from contexts where we do not track the liveness of the registers. So all caller saved registers must be saved and restored. If all APX registers are caller saved, then yes this is correct. |
Have you checked that these tests exercise |
Intel SDE allows us to collect execution traces with -itrace_execute_emulate and we found quite a lot of register save/ restorations around native method, there is already an existing test point for it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
OK, thanks for checking Jatin! Have you also checked whether, at least in some of the cases, some of the APX EGPRs are live across the runtime call (i.e. are defined before the call and used after the call), and whether the called runtime routine typically clobbers these registers? Knowing that this case is exercised in the test runs would be good to be confident about the correctness of the patch. |
Hi @robcasloz, test_ZRuntimeCallSpill_cpp.txt Given that gtests is a build-time validation and the JVM itself is built with with minimum feature set, hence am hesitant to add this along with the patch. BTW, ZRuntimeCallSpill is called as part of the slow path barrier for native methods, which can modify EGPRs. Let me know if you think it's good to land in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine. Eventually it would be nice if we could generalise this and have the logic in the MacroAssembler.
Just a small comment about the conditional rax push and pop.
Thanks for the details! Let me run some internal testing, since the PR affects spilling of non-extended registers too (due to special handling of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test results look good!
Thanks @robcasloz , @xmas92 and @sviswa7 for your reviews and approvals. |
/integrate |
Going to push as commit 5924c2d.
Your commit was automatically rebased without conflicts. |
@jatin-bhateja Pushed as commit 5924c2d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Patch spills APX EGPRs across runtime calls to slow-path barriers using PUSH2P/POP2 instructions with PPX hints.
These instructions operate over a pair of registers resulting into an smaller save/restoration JIT code, on the hind side they have hard alignment and balancing constraints, as they operate over 16-byte aligned stack address.
ZRuntimeCallSpill is agnostic to live register, thus resulting SPILL sequence should not modify the contents of the register.
Patch has been verified using Intel SDE all test under test/hotspot/jtreg/compiler/gcbarriers are green.
Kindly review and share your feedback.
Best Regards,
Jatin
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25351/head:pull/25351
$ git checkout pull/25351
Update a local copy of the PR:
$ git checkout pull/25351
$ git pull https://git.openjdk.org/jdk.git pull/25351/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25351
View PR using the GUI difftool:
$ git pr show -t 25351
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25351.diff
Using Webrev
Link to Webrev Comment